<%@ page import="java.util.*,com.db.tracker.vo.*,java.util.*,com.db.tracker.util.*,java.text.*,java.io.*"%>
<%@ page import="com.db.tracker.vo.ReleaseVO"%>
<%try {
				System.out.println("XXXXXXXXXXXXXXXXX START LOADING JSP PAGE XXXXXXXXXXXXXXXX");
				session = request.getSession();
		//		System.out.println("user_id..main"+ session.getAttribute("USER_ID"));

				//	temporary removed enable this line for login, and remove if(false){
					if (session.getAttribute("USER_ID") == null || !((String) session.getAttribute("SESSION_ID")).equals(session.getId())) {

				//	if(false){

					try {
						response.sendRedirect("LoginPage.jsp");
					} catch (IOException ioe) {
						ioe.printStackTrace();
					}

				} else { 
			//		System.out.println(">>>>>>>> 1 >>>>");
					String usergroupname = (String) session.getAttribute("USER_GROUP_NAME");
					DBUtil dbutil = new DBUtil(getServletContext());
					Vector sendUpdateVector = new Vector();
					String userid = (String)session.getAttribute("USER_ID")==null?"":(String)session.getAttribute("USER_ID");
				//	userid="ronaksureshbhai.patel@cgi.com";
					// String userUpdatedName = request.getParameter("userUpdatedName");
					String checkboxarray = request.getParameter("checkboxarray")==null?"":request.getParameter("checkboxarray");
					String moveToReleaseName = request.getParameter("moveToReleaseName")==null?"":request.getParameter("moveToReleaseName");
					String checkBoxButton = request.getParameter("checkBoxButton")==null?"":request.getParameter("checkBoxButton");
			//		System.out.println("checkBoxButton >>>> "+checkBoxButton);
			//		System.out.println("moveToReleaseName >>>> "+moveToReleaseName);
					String userUpdatedName = userid;
			//		System.out.println(">>>>>>>> 2 >>>>");
					if (userUpdatedName == null) {
						userUpdatedName = request.getParameter("hiddenUserUpdatedName") == null ? "": request.getParameter("hiddenUserUpdatedName");
					}

					java.text.SimpleDateFormat jsformatter =  new java.text.SimpleDateFormat("d MMM yyyy");
					String todate = jsformatter.format(new java.util.Date());
							
					String releaseName = request.getParameter("releaseName");

					if (releaseName == null) {
						releaseName = request.getParameter("hiddenRelName") == null ? "": request.getParameter("hiddenRelName");
					}
		//			System.out.println(">>>>>>>> 3 >>>>");
					Vector AllRelObjVector = new Vector();

					if(releaseName!=null){
						 AllRelObjVector = dbutil.getAllRelease(releaseName);
					}

					String search = (String) request.getParameter("searchButton") == null ? "": request.getParameter("searchButton");

					String update = (String) request.getParameter("updateButton") == null ? "": request.getParameter("updateButton");
				
				//	System.out.println("BBBBBBBBB"+update);

					String removeDocButton = request.getParameter("removeDocButton")==null?"":request.getParameter("removeDocButton");
					String saveandsend = (String) request.getParameter("saveandsendButton") == null ? "": request.getParameter("saveandsendButton");                   

				//	System.out.println("SSSSSSSSSSSSSSSSSSSSSSSSSS"+saveandsend);

					String delete = (String) request.getParameter("deleteButton") == null ? "": request.getParameter("deleteButton");
					int releaseObjKey = Integer.parseInt(request.getParameter("releaseObjKey") == null ? "0": request.getParameter("releaseObjKey"));

			//		System.out.println("Update Delete releaseObjKey" + update+ delete + releaseObjKey);

					Vector searchResults = new Vector();
					searchResults = null;
			//		System.out.println(">>>>>>>> 4 >>>>");
					Vector relNameVector = dbutil.getReleaseName(userid);
					Vector relUserVector = dbutil.getReleaseScriptUser();
					String sendmail = (String)request.getParameter("sendmailbutton")==null?"":(String)request.getParameter("sendmailbutton");
					String extraEmail = (request.getParameter("extraEmail")==null || request.getParameter("extraEmail").trim().equals(""))?"":request.getParameter("extraEmail");

					Vector ManadatoryCRObjVector = new Vector();
					ManadatoryCRObjVector = dbutil.getMandatoryCRObjType();
	
	
		//			System.out.println(">>>>>>>> 5 >>>>");
					%>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="styles/tracker_style.css">
		<title>
			Update Release Details
		</title>
		<script>
			function submitForms(obj){
		  	
					// alert("obj.value.length"+obj.value);
			
				obj.value = trim(obj.value);
	
				if (obj.value.length == 0)
				{
					alert("Please enter Object Name.");
					obj.focus();
					return false;
				 }
		  
				//  document.updateRelease.submit();
				//  document.searchReleaseForm.submit();
	
				//document.displayForm.submit();
		  	
		  				//  document.MainForm.submit();
						//alert("HIIIIIII");
		  } 	

		 function  upload(relid)
		 {
			 
			 dwin = window.open("rel_uploadpage.jsp?folder="+relid,"_blank","width=600,height=400,scrollbars=yes,resizable=yes");
			 
		 }

		 function download(path,filename)
		{
			//alert(path+"   "+filename);
			dwin = window.open("openDocument.jsp?path="+path+ "&filename="+filename,"_blank","width=600,height=400,scrollbars=yes,resizable=yes");
		//	document.displayForm.action="openDocument.jsp";
		//	document.displayForm.submit();
		//	document.displayForm.action="UpdateReleaseDetail.jsp";
		}

		function showFiles(o)
		{
		var opassitem = document.getElementById(o);
		//alert(event.srcElement.value);
		//var imgname = "img" + o;
		//var imgAct = document.all(imgname);
		if (opassitem.style.visibility == "hidden")
		{
			opassitem.style.visibility = "visible";
			//imgAct.src = "images/plus.gif";
		}
	/*	else
		{
			opassitem.style.visibility = "hidden";
			//imgAct.src = "images/minus.gif";
		}*/
		}
	function hideFiles(o){
		var opassitem = document.getElementById(o);
		if (opassitem.style.visibility == "visible")
		{
			opassitem.style.visibility = "hidden";
			//imgAct.src = "images/minus.gif";
		}
	}



	  function trim(sString)
		  {
			sTrimmedString = "";
		   if (sString != "") {
			  var iStart = 0;
			  var iEnd = sString.length - 1;
			 // var sWhitespace = " \t\f\n\r\v";
			 var sWhitespace = "   ";


			  while (sWhitespace.indexOf(sString.charAt(iStart)) != -1) {
				 iStart++;
				 if (iStart > iEnd)
					break;
			  }

			  // If the string not just whitespace
			  if (iStart <= iEnd) {
				 while (sWhitespace.indexOf(sString.charAt(iEnd)) != -1)
					iEnd--;
				 sTrimmedString = sString.substring(iStart,++iEnd);
			  }
		   }
		   return sTrimmedString;
		 }
		
		function addRow()
		{
			
			document.addRelease.releaseName.value =trim(document.addRelease.releaseName.value);
			document.addRelease.dBName.value =trim(document.addRelease.dBName.value);
			document.addRelease.objectName.value =trim(document.addRelease.objectName.value);
			document.addRelease.objectType.value =trim(document.addRelease.objectType.value);
			document.addRelease.userUpdated.value =trim(document.addRelease.userUpdated.value);
			document.addRelease.dateUpdated.value =trim(document.addRelease.dateUpdated.value);
			document.addRelease.sqlquery.value =trim(document.addRelease.sqlquery.value);

			document.addRelease.act.value="addRow";
			document.addRelease.submit();
		}

	    function delRow(num)
		{
			
			document.addRelease.delNumber.value=num;
			document.addRelease.act.value="delRow";
			
			//alert(document.addRelease.delNumber.value);
			document.addRelease.submit();
		}
		function save()
		{
			
			document.addRelease.act.value="save";
			document.addRelease.submit();
		}
	
		function editCRDetails(ReleaseObjKey) {
		dwin=window.open("EditReleaseCRDetail.jsp?relobjkey="+ReleaseObjKey,"detailWin","width=900,height=600,scrollbars=yes,resizable=yes");
		dwin.focus();
		
		}

		var globalArray = new Array();
		function changeCheckboxArray(checkBoxValue, releaseObjKey){
			
			if(checkBoxValue.checked){
				globalArray.push(releaseObjKey);
			}else{
				
				var functionArray = new Array();
				for(var v=0; v < globalArray.length; v+=1){
					if(releaseObjKey != globalArray[v]){
						functionArray.push(globalArray[v]);
					}
				
				}
				globalArray = functionArray ;
			}
		//	alert("globalArray >> "+ globalArray);
		}

		function checkValues(){
	
			document.CheckboxArrayForm.checkboxarray.value = globalArray;

			if(document.CheckboxArrayForm.checkboxarray.value == 0){
				alert("Kindly select the Release Objects to move.");
				return false;
			}
	
		//	document.CheckboxArrayForm.checkBoxButton.value = 'Move Selected Objects'; 
		//	document.CheckboxArrayForm.submit();
		}
	
	</script>
	</head>

	<body>


		<form name="updateRelease" method="post">
			<!-- 	<input type=hidden name=releaseName value=<%=releaseName%>>
			<input type=hidden name=userUpdatedName value=<%=userUpdatedName%>> -->
			<input type=hidden name="act" value="">
			<input type=hidden name="delNumber" value="">

			
			<table width=100%>
				<tr>
					<td width=100%>
						<jsp:include page="HeaderNav_ReleaseObject.jsp" />
					</td>
				</tr>
			</table>
			</form>

			<%
			//	System.out.println("userupdated :" + userUpdatedName+ "<releaseName>:" + releaseName + "<search>"+ search);

					%>
			<%/* if (search.equals("Search")) {

					 searchResults = dbutil.getSearchedReleased(releaseName,
					 userUpdatedName);

					 }
					 */
					if(checkBoxButton.equals("Move Selected Objects")){
						
						boolean moveRelObjectFlag = false;
						moveRelObjectFlag = dbutil.moveSelectedReleaseObjects(moveToReleaseName, checkboxarray);
						
						if(moveRelObjectFlag == false){
						%>
					  		<script>
								var targetRelName = '<%= moveToReleaseName %>';
								alert("Some of selected Release Objects are already exists in "+targetRelName+", So not moved to "+targetRelName);
							</script>
						<%
			  			}else{
						%>
					  		<script>
								var targetRelName = '<%= moveToReleaseName %>';
								alert("Selected Release Objects has been moved to "+targetRelName);
							</script>
						<%	
						}
					
					}		



					if(sendmail.equals("Send mail for Update")){
					  Vector sendingupdatevector = (Vector)session.getAttribute("SENDUPDATEVECTOR");
					  if(sendingupdatevector==null || sendingupdatevector.size()==0){
					  
					  %>
					  	<script>
							alert("Kindly update any Release Object first !!");
						</script>
					  
					  <%
					  
					  }else{
				///// rnk changes starts	  
				//	  System.out.println(">>>>>>>> 6 >>>>");
				//	  	System.out.println("save and send");
				String sender ="";
				String mailserver="";
				String header ="";
				 try {
				//File propfile = new File(System.getProperty("tracker.properties.home")+"/"+"STtracker.properties");
					Properties property = new Properties();
					File propfile = new File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
					InputStream in = new FileInputStream(propfile);
					property.load(in);
					sender = property.getProperty("RelMailSender")==null?"raman.kapil@db.com":property.getProperty("RelMailSender");
			//		System.out.println("sender " +  sender);
					mailserver = property.getProperty("MailServer");
					header= property.getProperty("UpdateRelHeader")==null?"@@ Updated existing Database Object/s of Release @@":property.getProperty("UpdateRelHeader");
			//		System.out.println("RelHeader " +  header);

					MailClass mailclass= new MailClass(mailserver);
					StringBuffer content = new StringBuffer();
					//String sender;
		
					
					ArrayList maillist = new ArrayList();
				//	maillist=dbutil.getRelMailList();

					Vector UpdatedObjVectorForMail = dbutil.getUpdatedRelObjForMail(sendingupdatevector);
					extraEmail = extraEmail.trim();
					StringTokenizer st = new StringTokenizer(extraEmail,",");
					int totaltoken = st.countTokens();
				
					int size = maillist.size(); 	
					String receive[] = new String[size+totaltoken+1];
			//		System.out.println("size" + size+userid);
				
					receive[0] = userid;
					int j=0;
					for(int i=0;i<size;i++)
					{
						MailListVO maillistvo = (MailListVO) maillist.get(i);
						receive[i+1]=maillistvo.getEmail();
				//		System.out.println("rec " + receive[i]);
						j = i+1;
					}
			//		System.out.println("check 1 >");
					while(st.hasMoreElements()){
			//			System.out.println("check 1.1 >");
						receive[++j] = st.nextToken();
			//			System.out.println("check 1.2 >");
					}
			//		System.out.println("check 2 >");
					content.append("The following database objects has been updated for Release. \t\t\t\t\t\t\t");
					content.append("\n\n\n");
			//		System.out.println(">>>>>>>> 7 >>>>");
		//			tempVector =(Vector) session.getAttribute("temVector");
					if(UpdatedObjVectorForMail != null )
					{
						for(int i=0;i<UpdatedObjVectorForMail.size();i++)
						{
							ReleaseVO relvo =(ReleaseVO) UpdatedObjVectorForMail.elementAt(i);
							content.append("\n"+(i+1)+"\tRelease Name : ");
							content.append(relvo.getReleaseName());
							content.append("\n\tDB Name : ");
							content.append(relvo.getDBName());
							content.append("\n\tObject Name : ");
							content.append(relvo.getObjName());
							content.append("\n\tObject Type : ");
							content.append(relvo.getObjType());
							content.append("\n\tUser : ");
							content.append(relvo.getUserUpdated());

							content.append("\n\n\n");


						}

					}
					
					content.append("-------------------------------------------------------------------------------------------------------------------");
					content.append("\n\n");
					content.append("System generated mail, DO NOT REPLY.");
					content.append("\nKindly contact Raman Kapil (raman.kapil@db.com) for more detail or any information.");

	
				%>
					
	
				<%for(int k=0;k<receive.length;k++){ 
			//		System.out.println(">"+receive[k]+"<");
					}
					
			//		System.out.println("check 3 >");
			//		mailclass.postMail(receive,header,content.toString(),sender);
			//		System.out.println("check 4 >");


				%>
						
					<script>
							alert("Mail sent successfully for updated objects during this session.");
					</script>
				

				<%		
					
				 }
				catch(Exception e)
				{
					System.out.println("Exception while sending mail :"+e);
					
					
				%>	

					<script>
							alert("Sorry, some problem occured while sending mail, Please try again later,");
					</script>
				
					
				<%	

				}

				///// rnk changes ends	  
					  } 	
						  
					
					
					}

					if(removeDocButton.equals("Remove Doc")){
					
						

							Properties property = new Properties();
							String filepath = new String();
							try {
									//File propfile = new File(System.getProperty("tracker.properties.home")+"/"+"STtracker.properties");
									File propfile = new File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
									InputStream in = new FileInputStream(propfile);
									property.load(in);
									filepath = property.getProperty("DocumentPath");
							//		System.out.println("11111111111111111111111");
							}
							catch(Exception e) {
									System.out.println("in exception..LOADFILE>>>>>CONSTRUCTOR");
							}
							String path = filepath + "RelObjects/" + releaseObjKey ;
					//		System.out.println("PATH"+path);
							 File totalpath=new  File(path) ;
	 						boolean removedocflag=false;
								
							if (totalpath.isDirectory()) 
							{
								File list[] = totalpath.listFiles();
								
								for(int i=0;i<list.length;i++)
								{
								 list[i].delete();
								}

								removedocflag = totalpath.delete();
								
							}

							if(removedocflag==true){
							%>
							<script>
							alert("Attached Document removed successfully !!");
							</script>
							
							
							<%
							}else{
							%>
						<!--	
							<script>
							alert("Sorry, some problem occured while removing Attached Document, Please try again later.");
							</script>
						-->	
							<%							
							}


					}

					if (update.equals("Update")) {
		//				System.out.println(">>>>>>>> 8 >>>>");
						String upd_ReleaseName = request.getParameter("releaseList")==null?"":request.getParameter("releaseList");
						String upd_DBName = request.getParameter("dbName")==null?"":request.getParameter("dbName");
						String upd_ObjType = request.getParameter("objectType")==null?"":request.getParameter("objectType");
						String upd_ObjName = request.getParameter("objectName")==null?"":request.getParameter("objectName");
						upd_ObjName = dbutil.RemoveWhiteSpace(upd_ObjName);
	
						String upd_sqlquery = request.getParameter("sqlquery")==null?"":request.getParameter("sqlquery");
				//		String upd_UserUpdated = (String)session.getAttribute("USER_ID")==null?"":(String)session.getAttribute("USER_ID");
						String upd_UserUpdated = userid;
						String upd_ReleaseObjKey = request.getParameter("releaseObjKey")==null?"0":request.getParameter("releaseObjKey");
						
												
						ReleaseVO updVO = new ReleaseVO();

						updVO.setReleaseName(upd_ReleaseName);
						updVO.setDBName(upd_DBName);
						updVO.setObjType(upd_ObjType);
						updVO.setObjName(upd_ObjName);
						updVO.setUserUpdated(upd_UserUpdated);
						updVO.setSqLQuery(upd_sqlquery);
						updVO.setReleaseObjKey(Integer.parseInt(upd_ReleaseObjKey));
						updVO.setDateUpdated(todate);
				//		System.out.println("inside Update");
						
						Vector varifyResults = (Vector)session.getAttribute("SEARCHEDRESULTS");
			//			System.out.println(">>>>>> upd_ObjType"+upd_ObjType);
						if(AllRelObjVector !=null){
						if(dbutil.validVo(AllRelObjVector,updVO)){
						
						dbutil.updateSearchedResults(updVO);
						if(session.getAttribute("SENDUPDATEVECTOR")!=null){
							sendUpdateVector = (Vector)session.getAttribute("SENDUPDATEVECTOR");
						}
						
						sendUpdateVector.add(upd_ReleaseObjKey);
						session.removeAttribute("SENDUPDATEVECTOR");
						session.setAttribute("SENDUPDATEVECTOR",sendUpdateVector);

						}else
							{
							%>
							<script>
							alert("This Object already exists for selected release, Can not add same object twice !!");
							</script>
					
							<%	// System.out.println("::Int ITS not VALID");

							}






						}



					}

					if (delete.equals("Delete")) {
						int relObjKey = Integer.parseInt(request
								.getParameter("releaseObjKey"));
						dbutil.deleteReleaseObject(relObjKey);
					}

					%>
					<%
	//		System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHhhhhhhhh"+saveandsend);

			if("Save&Send".equals(saveandsend))
			{
				
	//			System.out.println("KKKKKKKKKKIn save and send");
				String sender ="";
				String mailserver="";
				String header ="";
	//			System.out.println(">>>>>>>> 9 >>>>");
				 try {
				//File propfile = new File(System.getProperty("tracker.properties.home")+"/"+"STtracker.properties");
					Properties property = new Properties();
					File propfile = new File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
					InputStream in = new FileInputStream(propfile);
					property.load(in);
					sender = property.getProperty("RelMailSender");
	//				System.out.println("sender " +  sender);
					mailserver = property.getProperty("MailServer");
					header= property.getProperty("UpdateRelHeader");
	//				System.out.println("RelHeader " +  header);

					MailClass mailclass= new MailClass(mailserver);
					StringBuffer content = new StringBuffer();
					//String sender;
		
					
					ArrayList maillist = new ArrayList();
					maillist=dbutil.getRelMailList();

					
					
					int size = maillist.size(); 	
					String receive[] = new String[size];
	//				System.out.println("size" + size);
					for(int i=0;i<size;i++)
					{
						MailListVO maillistvo = (MailListVO) maillist.get(i);
						receive[i]=maillistvo.getEmail();
	//					System.out.println("rec " + receive[i]);
					}

					String upd_ReleaseName = request
							.getParameter("releaseList");
					String upd_DBName = request.getParameter("dbName");
					String upd_ObjType = request.getParameter("objectType");
		//			System.out.println("IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIType"+upd_ObjType);
					String upd_ObjName = request.getParameter("objectName");
			//		String upd_UserUpdated = (String)session.getAttribute("USER_ID")==null?"":(String)session.getAttribute("USER_ID");
					String upd_UserUpdated = userid;
					String upd_ReleaseObjKey = request
							.getParameter("releaseObjKey");
					String upd_sqlquery = request.getParameter("sqlquery");

					ReleaseVO updVO = new ReleaseVO();

					updVO.setReleaseName(upd_ReleaseName);
					updVO.setDBName(upd_DBName);
					updVO.setObjType(upd_ObjType);
					updVO.setObjName(upd_ObjName);
					updVO.setUserUpdated(upd_UserUpdated);
					updVO.setSqLQuery(upd_sqlquery);
					
					updVO.setReleaseObjKey(Integer
							.parseInt(upd_ReleaseObjKey));
		//			System.out.println("inside send Update");
					content.append("The following release object is Edited  \t\t\t\t\t\t\t");

					content.append("\n\tRelease Name : ");
					content.append(updVO.getReleaseName());
					content.append("\n\tDB Name : ");
					content.append(updVO.getDBName());
					content.append("\n\tObject Name : ");
					content.append(updVO.getObjName());
					content.append("\n\tObject Type : ");
					content.append(updVO.getObjType());
					content.append("\n\tUser : ");
					content.append(updVO.getUserUpdated());


					dbutil.updateSearchedResults(updVO);
				%>
					<table width="750">		
					<tr>
					<td class='smalltext'><font color='red'>Saved Successfully </font></td>
					<td class='smalltext'><a href="mainpage.jsp" > Back to Main Page</a></td>
					</tr>
					 
					</table>

				<%	
					
				//mailclass.postMail(receive,header,content.toString(),sender);
//					System.out.println(">>>>>>>> 10 >>>>");
				%>
				<table width="750">		

				<td class='smalltext'><font color='red'>Mail Sent Successfully </font></td>
				</table>
				

				<% }
				catch(Exception e)
				{
				%>
					<table width="750">		

							<td class='smalltext'><font color='red'>Could not connect to SMTP host. Sending failed.</font></td>
					</table>


				<%	
					e.printStackTrace();
				}


			}

			


		%>

			<!--	
		<%
			String act =(String) request.getParameter("act");
			Vector allRel=null;
			Vector tempVector= new Vector();
			ReleaseVO tempVo = null;
		//	java.text.SimpleDateFormat jsformatter =  new java.text.SimpleDateFormat("d MMM yyyy");
		//	String todate = jsformatter.format(new java.util.Date());
			
			if( act == null )
			{
				System.out.println("ACT  Null");
		//		 allRel = dbutil.getAllRelease();
				session.removeAttribute("allRelVector");
				session.setAttribute("allRelVector",allRel);

				

			}
			else if("addRow".equals(act))
			{
				allRel =(Vector) session.getAttribute("allRelVector");
				if((Vector) session.getAttribute("temVector")== null)
				{
					System.out.println("Its null"+(Vector) session.getAttribute("temVector"));
					tempVo = new ReleaseVO();
					tempVo.setReleaseName((String)request.getParameter("releaseName"));
					tempVo.setDBName((String)request.getParameter("dBName"));
					tempVo.setObjName((String)request.getParameter("objectName"));
					tempVo.setObjType((String)request.getParameter("objectType"));
					tempVo.setDateUpdated((String)request.getParameter("dateUpdated"));
					tempVo.setUserUpdated((String)request.getParameter("userUpdated"));
					
					if( dbutil.validVo(allRel,tempVo))	
					{
						System.out.println("::Int ITS VALID");
						tempVector.add(tempVo);
						session.removeAttribute("temVector");
						session.setAttribute("temVector",tempVector);
						tempVo = null;
					}
					else
					{
					%>
						<script>
						alert("This entry already exists.Can not be added..");
						</script>
					
					<%	System.out.println("::Int ITS not VALID");

					}
				
					
				}
				else
				{
					System.out.println("Its NOT null"+(Vector) session.getAttribute("temVector"));
					tempVo = new ReleaseVO();
					tempVector = (Vector) session.getAttribute("temVector");
					tempVo.setReleaseName((String)request.getParameter("releaseName"));
					tempVo.setDBName((String)request.getParameter("dBName"));
					tempVo.setObjName((String)request.getParameter("objectName"));
					tempVo.setObjType((String)request.getParameter("objectType"));
					tempVo.setDateUpdated((String)request.getParameter("dateUpdated"));
					tempVo.setUserUpdated((String)request.getParameter("userUpdated"));
					if(dbutil.validVo(tempVector,tempVo) && dbutil.validVo(allRel,tempVo))
					{
						System.out.println("ITS VALID");
						tempVector.add(tempVo);
						session.removeAttribute("temVector");
						session.setAttribute("temVector",tempVector);
						tempVo = null;
					}
					else
					{
					%>
						<script>
						alert("This entry already exists.Can not be added..");
						</script>

					<%
						System.out.println("ITS not VALID");
					}


				}

			}
			else if("delRow".equals(act))
			{
				String delNo = (String) request.getParameter("delNumber");
				
				if(delNo != null)
				{
					int deleteNum = Integer.parseInt(delNo);
				
					tempVector =(Vector) session.getAttribute("temVector");
					tempVector.remove(deleteNum);
					session.removeAttribute("temVector");
					session.setAttribute("temVector",tempVector);


				}
			}
			else if("save".equals(act))
			{
					System.out.println("^^^^^^^^^^^^^^^^^^^^^^");
					tempVector =(Vector) session.getAttribute("temVector");
					dbutil.saveRelease(tempVector);
					session.removeAttribute("temVector");
					
			//		 allRel = dbutil.getAllRelease();
					session.removeAttribute("allRelVector");
					session.setAttribute("allRelVector",allRel);
			}

		%>
  -->

		<a href="mainpage.jsp">Back to Main </a>
		<form name="searchReleaseForm" action="UpdateReleaseDetail.jsp" method="post">
			<!-- <input type=hidden name=releaseName value=<%=releaseName%>>
		<input type=hidden name=userUpdatedName value=<%=userUpdatedName%>>   -->
			<table cellpadding="0" cellspacing="1" width="100%" style="BORDER:#000000 1px solid" colspan=5>
				<tr bgcolor=#EFEFEF>
					<td class=bodyblue>
						<b>
							Release Name
						</b>
					</td>

					<td class=bodyblue>
						<select name=releaseName>

							<!-- <option value='All' <% out.println("selected");%>>
								All
							</option>
						-->
							<%
	//						System.out.println(">>>>>>>> 11 >>>>");	
							for (int i = 0; i < relNameVector.size(); i++) {
						ReleaseVO relbean = (ReleaseVO) relNameVector
								.elementAt(i);
						
						%>

							<option value='<%=	relbean.getReleaseName()%>' <%= releaseName.equals(relbean.getReleaseName())?"selected":""%>>
								<%=relbean.getReleaseName()%>
							</option>

							<%}

					%>
						</select>
					</td>


					<td class=bodyblue>
						<b>
							User Name
						</b>
					</td>


					<td class=bodyblue>
							<input type=text name=userUpdatedName size=50 value=<%=userid%> <% out.println("disabled"); %>> 
						<!--
						   <select name=userUpdatedName>

							<option value='All' <% out.println("selected");%>>
								All
							</option>

							<%//	for (int i = 0; i < relUserVector.size(); i++) {
							//		ReleaseVO relbean = (ReleaseVO) relUserVector.elementAt(i);

						%>

							<option value='<%//=	relbean.getUserUpdated()%>' <%//= userUpdatedName.equals(relbean.getUserUpdated())?"selected":""%>>
								<%//=relbean.getUserUpdated()%>
							</option>

							<%//}

					%>
						</select>

						-->
					</td>
					<td>
						<input type=submit class=whitebutton name=searchButton value=Search onclick="submit()">
					</td>

					

				</tr>
				<tr bgcolor=#EFEFEF>

					<td class=bodyblue colspan=2>
						<b>
							Enter other email id to send the email [optional]:
						</b>
						<img id="" src="/st/images/help.jpg" border="0" width="12" height="15" onMouseover="javascript:showFiles('SelectViewHelp');" onMouseout="javascript:hideFiles('SelectViewHelp');">
		        <div id="SelectViewHelp" style="position:absolute; left:event.x; top:event.y; visibility: hidden; BORDER:#666666 1px solid;background-color: #efefef;width:300px;padding:5px;" onMouseover="javascript:showFiles('SelectViewHelp');" onMouseout="javascript:hideFiles('SelectViewHelp');">
		        <br>You can inform other users also by email for updated objects during this session, by entering email ids here. also can enter more then one email ids by comma(,) separated.
		        </div>


					</td>
					
					<td class=bodyblue colspan=2>
							<input type=text name=extraEmail size=50 > 
					</td>
				
					<td colspan=1>
						<input type=submit class=whitebutton name=sendmailbutton value="Send mail for Update" onclick="submit()">
					</td>
					<td></td>
					<td></td>

				</tr>
			</table>
		</form>


		<%if (search.equals("Search") || update.equals("Update")
							|| delete.equals("Delete")||"Save&Send".equals(saveandsend) || removeDocButton.equals("Remove Doc") || sendmail.equals("Send mail for Update")) {
						searchResults = dbutil.getSearchedReleased(releaseName,
								userUpdatedName);
			//			System.out.println("searchResults.size()"+ searchResults.size());
						session.removeAttribute("SEARCHEDRESULTS");
						session.setAttribute("SEARCHEDRESULTS",searchResults);
						%>

		<%if (searchResults != null && searchResults.size() != 0) {
							Vector dbVector = dbutil.getDbNameVO();
							Vector relListVector = dbutil.getReleaseName();

							%>


		<table cellpadding="0" cellspacing="3" width="105%" style="BORDER:#000000 1px solid" colspan=10>

			<tr bgcolor="#000077" >

			<!--
				<td class=smallfonthead colspan=1 width="15%">
					<b>
						Release Name
					</b>
				</td>
			-->	
				
				<td class=smallfonthead colspan=1 width="10%">
					<b>
						DB Name
					</b>
				</td>
				<td class=smallfonthead colspan=1 width="10%">
					<b>
						Object Type
					</b>
				</td>
				<td class=smallfonthead colspan=1 width="27%">
					<b>
						Object Name / SQL Query
					</b>
				</td>
				<td class=smallfonthead colspan=1 width="15%">
					<b>
						CR Details
					</b>
				</td>
				<td class=smallfonthead colspan=1 width="5%">
					<b>
						Move <br>Selected <br>Objects
					</b>
				</td>
		<!--		
				<td class=smallfonthead>
					<b>
						Sql Query
					</b>
				</td>
		
				<td class=smallfonthead colspan=1 width="5%">
					<b>
						User Updated
					</b>
				</td>
		-->
				<td class=smallfonthead colspan=2 width="14%">
					<b>
						Actions for Objects
					</b>
				</td>
				<td class=smallfonthead colspan=2 width="14%">
					<b>
						Actions for Docs.
					</b>
				</td>

				<td class=smallfonthead colspan=1 width="10%" >
					<b>
						Uploads
					</b>
				</td>
		
			</tr>

			<%
//			System.out.println(">>>>>>>> 12 >>>>");	
			for (int i = 0; i < searchResults.size(); i++) {
								ReleaseVO dispVo = (ReleaseVO) searchResults
										.elementAt(i);

								%>
			<form name="displayForm" action="UpdateReleaseDetail.jsp" method="post">
			<input type=hidden name=uplod value='<%=dispVo.getReleaseObjKey()%>' >

			<% 
			//	System.out.println("YYYYYYYYYYYYYYYYYYYYYYYYYYY"+dispVo.getReleaseObjKey()) ; 
			%>
				<tr bgcolor=#EFEFEF>

				<input type=hidden name=releaseList value='<%=dispVo.getReleaseName()%>' >

				<!--
				  
					<td class=bodyblue colspan=1 width="15%" align='center'>
						<select name="releaseList">
							<%for (int j = 0; j < relListVector.size(); j++) {
									ReleaseVO relvo = (ReleaseVO) relListVector
											.elementAt(j);
									String relname = relvo.getReleaseName() == null ? ""
											: relvo.getReleaseName();

									%>

							<option value='<%=	relvo.getReleaseName()%>' <%=  (dispVo.getReleaseName()).equals(relname)? "selected":"" %>>
								<%=relvo.getReleaseName()%>
							</option>

							<%}

								%>
						</select>
					</td>
				-->	
					<td class=bodyblue colspan=1 width="10%" align='center'>
						<select name=dbName>
							<%for (int j = 0; j < dbVector.size(); j++) {
									DbNameVo dbvo = (DbNameVo) dbVector
											.elementAt(j);
									String dbname = dbvo.getDBName() == null ? ""
											: dbvo.getDBName();

									%>

							<option value='<%=	dbvo.getDBName()%>' <%=  (dispVo.getDBName()).equals(dbname)? "selected":"" %>>
								<%=dbvo.getDBName()%>
							</option>

							<%}

								%>
						</select>
					</td>

					


					<td class=bodyblue colspan=1 width="10%" align='center'>
						<select name=objectType>
							<%
			
								Vector objTypeVector = dbutil.getObjTypeVO();
			
								for (int j = 0; j < objTypeVector.size(); j++) {
									ObjectTypeVO objvo = (ObjectTypeVO) objTypeVector.elementAt(j);
									String objType = objvo.getObjType();
			


									%>

							<option value='<%=objvo.getObjType()%>' <%= (dispVo.getObjType()).equals(objType)?"selected":"" %>>
								<%=objvo.getObjType()%>
							</option>

							<% 									

								}

								%>
						</select>
					</td>

					<%
				//	  System.out.println(">> : "+dispVo.getObjName());	
					%>
					<td class=bodyblue colspan=1 width="27%" align='center'>
						<INPUT type=text name=objectName  size=65 value=`<%= dispVo.getObjName() %>`>
					</td>

					<td class=bodyblue colspan=1 width="15%" align='center'>
						<%if(ManadatoryCRObjVector.contains(dispVo.getObjType())){%>
						<a href="javascript:editCRDetails('<%=dispVo.getReleaseObjKey()%>')">Edit</a>
						<%}%>
					</td>
					<td class=bodyblue colspan=1 width="5%" align='center'>
						<input type="checkbox" name="objCheckBox" onClick='return changeCheckboxArray(this, <%= dispVo.getReleaseObjKey()%>)'>
					</td>


				<!--
					<td class=bodyblue>
					<INPUT type=text name=sqlquery value='<%=null ==  dispVo.getSqLQuery() ? "" : dispVo.getSqLQuery()%>'>
					</td>
				

					<!-- 	<td class=bodyblue ><INPUT type=text  value='<%= dispVo.getUserUpdated() %>' ></td>	
					<td class=bodyblue colspan=1 width="5%" align='center'>
						<select name=userList>


							<%for (int j = 0; j < relUserVector.size(); j++) {
									ReleaseVO relbean = (ReleaseVO) relUserVector
											.elementAt(j);

									%>

							<option value='<%=	relbean.getUserUpdated()%>' <%= (dispVo.getUserUpdated()).equals(relbean.getUserUpdated())?"selected":""%>>
								<%=relbean.getUserUpdated()%>
							</option>

							<%}

								%>
						</select>
					</td>
						
				--->
					<% // System.out.println("KKKKKKKKKKKKKKKKKKKKKKKKKKKK"+dispVo.getSqLQuery()); 
					%>

					<td class=bodyblue colspan=1 width="7%" align='center'>
						<input type=submit class=whitebutton name=updateButton value='Update' onClick="return submitForms(objectName)">
                    </td>
					<td class=bodyblue colspan=1 width="7%" align='center'>
			<!--		<input type=submit class=whitebutton name=saveandsendButton value='Save&Send' onclick="submit()">  -->
						<input type=submit class=whitebutton name=deleteButton value='Delete' onclick="submit()">
                    </td>
					<td class=bodyblue colspan=1 width="7%" align='center'>&nbsp|&nbsp
						<input type=button class=whitebutton name=uploadButton value='Upload' onclick="upload('<%=dispVo.getReleaseObjKey()%>')">
                    </td> 
					<td class=bodyblue colspan=1 width="7%" align='center'>
						<input type=submit class=whitebutton name=removeDocButton value='Remove Doc' onclick="submit()">
						
						<input type=hidden name=releaseObjKey value=<%=dispVo.getReleaseObjKey()%>>
						<input type=hidden name=hiddenRelName value='<%=releaseName%>'>
						<input type=hidden name=hiddenUserUpdatedName value='<%=userUpdatedName%>'>

					</td>
				
					
					
					
					<td class=bodyblue colspan=1 width="10%" >

					<%

							Properties property = new Properties();
							String filepath = new String();
							try {
									//File propfile = new File(System.getProperty("tracker.properties.home")+"/"+"STtracker.properties");
									File propfile = new File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
									InputStream in = new FileInputStream(propfile);
									property.load(in);
									filepath = property.getProperty("DocumentPath");
							//		System.out.println("11111111111111111111111");
							}
							catch(Exception e) {
									System.out.println("in exception..LOADFILE>>>>>CONSTRUCTOR");
							}
							String path = filepath + "RelObjects/" + dispVo.getReleaseObjKey() ;
					//		System.out.println("PATH"+path);
							 File totalpath=new  File(path) ;
	 	
							if (totalpath.isDirectory()) 
							{
								File list[] = totalpath.listFiles();
								if(list.length >0 )
								{
									for(int j=0;j<list.length;j++){
										String filename =list[j].getName();
						%>
										
										<a href="openDocument.jsp?path=<%=path%>&filename=<%=filename%>" class=link > <%=filename%>
										
						<%			}
								}
							}

						%>
					</td >
					

				</tr>

			</form>

			<%}

						%>
		</table>

		<form name="CheckboxArrayForm" method="post" action="UpdateReleaseDetail.jsp">
			<input type="hidden" name="searchButton" value="Search">
			<input type="hidden" name="releaseName" value="<%=releaseName%>">
			<input type="hidden" name="checkboxarray">
			<table cellpadding="0" cellspacing="1" width="60%" style="BORDER:#000000 1px solid" align=center colspan=3>
			<tr bgcolor="#EFEFEF">
	
					<td class=bodyblue align=right><b>Target Release&nbsp</b></td>

					<td class=bodyblue align=center>
						<select name=moveToReleaseName>

							<!-- <option value='All' <% out.println("selected");%>>
								All
							</option>
						-->
							<%for (int i = 0; i < relNameVector.size(); i++) {
								ReleaseVO relbean = (ReleaseVO) relNameVector.elementAt(i);
			
								if(releaseName.equals(relbean.getReleaseName())){
								// dont provide in drop down
								}else{
								%>
								<option value='<%=	relbean.getReleaseName()%>' >
									<%=relbean.getReleaseName()%>
								</option>
							<%}
							}
							%>
						</select>

						<img id="" src="/st/images/help.jpg" border="0" width="12" height="15" onMouseover="javascript:showFiles('SelectViewHelp1');" onMouseout="javascript:hideFiles('SelectViewHelp1');">
						<div id="SelectViewHelp1" style="position:absolute; left:event.x; top:event.y; visibility: hidden; BORDER:#666666 1px solid;background-color: #efefef;width:300px;padding:5px;" onMouseover="javascript:showFiles('SelectViewHelp1');" onMouseout="javascript:hideFiles('SelectViewHelp1');" align=left>
				        <br>User can move the selected 'Release Objects' from current Release to any other Release (by selecting from the drop down). <br>If the selected 'Release Objects' are already exists in target release then those objects will not get moved from the current release.
				        </div>
					</td>

					<td class=bodyblue align=center>
						<input type=submit class=whitebutton name="checkBoxButton" value="Move Selected Objects" onclick="return checkValues()">
					</td>

			</tr>
		</table>
		</form>

		<%} else {

						%>
		<table cellpadding="0" cellspacing="1" width="100%" style="BORDER:#000000 1px solid">
			<tr bgcolor="#000077">

				<td class=smallfonthead>
					<b>
						No Results for this Criteria
					</b>
				</td>

			</tr>
		</table>
		<%}

			




			%>
	<%}
		%>

		
	</body>
</html>

<%}
			} catch (Exception e) {
				e.printStackTrace();
			}

		%>
